<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/bootstrap-responsive.css" rel="stylesheet">
    <link href="js/bootstrap.js" rel="stylesheet">
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<?php
$status_array = array("1"=>"已通过","0"=>"待审核","2"=>"已拒绝");

include("/usr/local/apache2/htdocs/jibaiwang/lib/Login.php");
include('log4php/Logger.php');
$cfgfile = "/usr/local/apache2/htdocs/jibaiwang/admin/bootstrap/conf/config.ini";
$defarray = parse_ini_file($cfgfile, 1);
$qlogtag = $defarray["Login"]['qlogtag'];
Logger::configure($defarray["Login"]['qlogcfg']);
$logger = Logger::getLogger($qlogtag);
$host = $defarray["Login"]["host"];
$user = $defarray["Login"]["user"];
$pass = $defarray["Login"]["pass"];
$db = $defarray["Login"]["db"];
$dbh = new Sqlexecutor($host, $user, $pass, $db);
$s = new Login($dbh,$logger);
if($_REQUEST["op"] == "del")
{
    $res = $s->deleteByID($_REQUEST["rule_id"]);
}    
if($_REQUEST["op"] == "on")
{
    $res = $s->confirmByID($_REQUEST["rule_id"]);
}
$list = $s->getList();
?>
<div id="myModal" class="modal hide fade">

  <div class="modal-header">
  <a class="close" data-dismiss="modal" >&times;</a>
  <h3>修改密码</h3>
  </div>

<div class="modal-body">
  <p>
<form method="post" enctype="multipart/form-data" class="form-horizontal" action="Login.php">
<fieldset>
  <div class="control-group">
  <span class="help-inline">新密码:</span>
  <input type="text" name="pass" class="span3" placeholder="输入新密码">
  <input type="hidden" name="usr_idd" class="span1" value="<?php echo $_REQUEST["uuid"];?>">
  </div>
  </div>
</fieldset>
</p>
  <div class="modal-footer">
  <a href="#" class="btn" data-dismiss="modal" >关闭</a>
  <button type="submit" class="btn btn-primary">保存更改</button>
  </div>
  </form>
</div>
<?php
//var_dump($_REQUEST);
?>
<legend>经销商管理</legend>
    <div class="span20">
      <table class="table table-striped">
        <thead>
          <tr>
            <th>#</th>
            <th>用户名</th>
            <th>姓名</th>
            <th>邮箱</th>
            <th>电话</th>
            <th>公司名称</th>
            <th>公司地址</th>
            <th>状态</th>
            <th>注册日期</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
        <form class="well form-inline" target="_self">
<?php
    foreach($list as $key => $value)
    {
        echo "<tr>";
        echo '<td><input id="b_'.$value["id"].'" type="hidden" class="span1" name="b_id" readonly value="'.$value["id"].'">'.$value["id"].'</td>';
        echo "<td>".$value["username"]."</td>";
        echo "<td>".$value["name"]."</td>";
        echo "<td>".$value["email"]."</td>";
        echo "<td>".$value["tel"]."</td>";
        echo "<td>".$value["corp_name"]."</td>";
        echo "<td>".$value["address"]."</td>";
        echo "<td>".$status_array[$value["status"]]."</td>";
        echo "<td>".$value["insert_date"]."</td>";
        echo "<td>";
        echo '<div class="btn-group"><button  class="btn btn-warning dropdown-toggle" data-toggle="dropdown" href="#">操作<span class="caret"></span></button>';
        //echo '<div class="btn-group"><a  class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>';
        echo '<ul class="dropdown-menu">'; 
        echo '<li><a onclick="modify_on('.$value["id"].')"><i class="icon-ok"></i> 审核通过</a></li>';
        echo '<li><a onclick="modify_del('.$value["id"].')"><i class="icon-trash"></i> 删除</a></li>';
        echo '<li><a data-toggle="modal" href="?uuid=aa&bba=wef#myModal"  ><i class="icon-pencil"></i> 修改密码</a></li>';
        echo "</div>";
        echo "</td>";
        echo "</tr>";
    }
?>
        </form>
        </tbody>
      </table>
    </div>


    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster
    <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> -->
    <script src="js/jquery.js"></script>
    <script src="js/google-code-prettify/prettify.js"></script>
    <script src="js/bootstrap-transition.js"></script>
    <script src="js/bootstrap-alert.js"></script>
    <script src="js/bootstrap-modal.js"></script>
    <script src="js/bootstrap-dropdown.js"></script>
    <script src="js/bootstrap-scrollspy.js"></script>
    <script src="js/bootstrap-tab.js"></script>
    <script src="js/bootstrap-tooltip.js"></script>
    <script src="js/bootstrap-popover.js"></script>
    <script src="js/bootstrap-button.js"></script>
    <script src="js/bootstrap-collapse.js"></script>
    <script src="js/bootstrap-carousel.js"></script>
    <script src="js/bootstrap-typeahead.js"></script>
    <script src="js/application.js"></script>
    <script src="js/customize.js"></script>
    
<script type="text/javascript">
function modify_del(id){
        if(window.confirm("确定删除吗？")){
            str="?op=del&rule_id="+id
            window.open(str,'_self');
        }
}

function modify_on(id){
    if(window.confirm("确定通过吗？")){
        str="?op=on&rule_id="+id
            window.open(str,'_self');
    }
}
</script>
    
<script>
$('.carousel').carousel({
    interval: 12000
})
</script>

</body>
</html>
